/*
 * @Description: 该文件描述
 * @FilePath: \vue-web-template\src\utils\i18n.ts
 * @Author: Brian Brian@gmail.com
 * @Date: 2024-10-25 15:20:46
 * @LastEditors: Brian Brian@gmail.com
 * @LastEditTime: 2024-10-25 15:23:19
 */
import { storageLocal } from "@wxcn/utils";
import { createI18n } from "vue-i18n";
export const i18n = (locales: Record<string, any>, languageDefault: string) => {
  return createI18n({
    legacy: false,
    locale: storageLocal.getItem("__language__") || languageDefault,
    fallbackLocale: "zh-CN",
    silentFallbackWarn: true,
    silentTranslationWarn: true,
    missingWarn: false,
    fallbackWarn: false,
    messages: {
      "en-US": locales.enUS,
      "zh-CN": locales.zhCN,
    },
  });
};
